﻿using CacheAttribute.Attributes;
using CacheAttributeTestWebAPI.SomeDomains;
using Microsoft.AspNetCore.Mvc;

namespace CacheAttributeTestWebAPI.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class TestController:ControllerBase
    {
        private readonly ILogger<TestController> _logger;

        public TestController(ILogger<TestController> logger)
        {
            _logger = logger;
        }

        [HttpGet]
        [CacheAble(preffix:"T1",totoal_Name:"TestController#EMP_NO",work:true)]
        public string CacheTest(string EMP_NO,string Password)
        {
            return "WTF";
        }

        [HttpGet]
        [CacheAble(preffix:"T2",totoal_Name:"ALLStudent",work:true)]
        public List<Student> GetStudentList()
        {
            List<Student> students = new List<Student>() { 
                new Student("HJX","XJX",2022,DateTime.Now),
                new Student("万天","XJX",2022,DateTime.Now)
            };

            _logger.LogInformation("Executing :WDNMD现在在走方法");

            return students;
        }

    }
}
